/*
 * @Descripttion:
 * @version:
 * @Author: sueRimn
 * @Date: 2025-06-02 15:37:45
 * @LastEditors: sueRimn
 * @LastEditTime: 2025-08-05 19:39:41
 */
#include "step.h"
#include "stdio.h"
#include "public.h"




void fastStopCmd()
{
    uint8_t ucMotorAddr = 0x01;
    uint8_t ucCmd = 0x23;
    uint16_t usObject1 = 0xFF60;
    uint8_t ucObjcet2 = 0x03;
    uint8_t aucData[4] = {0,0,0,0};

    canCtrlMotor(ucMotorAddr,ucCmd,usObject1,ucObjcet2,aucData);
		
		ucMotorAddr = 0x02;
		
		canCtrlMotor(ucMotorAddr,ucCmd,usObject1,ucObjcet2,aucData);
}

void fastStopTrigCallback(uint16_t GPIO_Pin)
{
    //添加消抖及急停代码
    if(GPIO_Pin == FAST_STOP_Pin)
    {
        if(HAL_GPIO_ReadPin(FAST_STOP_GPIO_Port,FAST_STOP_Pin))
        {
					if(pstDev->stDevMotor.bIsStop == false)
					{
            pstDev->stDevMotor.bIsStop = true;
						printf("motor faststop\r\n");
            fastStopCmd();
            canReportSwitch(0,0,1);
					}
        }
        else
        {
					if(pstDev->stDevMotor.bIsStop == true)
					{
            pstDev->stDevMotor.bIsStop = false;
            canReportSwitch(0,0,0);
						printf("motor disable faststop\r\n");
					}
				}
    }
}